#--
左边部分引用
--#
<div class="fly-panel detail-box">
    <h1>#(article.title)</h1>
    <div class="fly-detail-info">
        <!-- <span class="layui-badge">审核中</span> -->
        <!--<span class="layui-badge layui-bg-green articletail-column">动态</span>-->

        <!--<span class="layui-badge" style="background-color: #999;">未结</span>-->
        <!-- <span class="layui-badge" style="background-color: #5FB878;">已结</span> -->

        #if(article.is_top ?? == 'on')
        <span class="layui-badge layui-bg-black">置顶</span>
        #end
        #if(article.is_quintessence ?? == 'on')
        <span class="layui-badge layui-bg-red">精帖</span>
        #end
        <div class="fly-admin-box" data-id="123">

        ###需要管理员权限才能显示
        #shiroHasAllRoles(admin)
            <span class="layui-btn layui-btn-xs jie-admin"  data-type="delete">删除</span>
            #if(article.is_top ?? == 'on')
            <span class="layui-btn layui-btn-xs jie-admin" data-type="cancelTop"type="set" field="stick" rank="0" style="background-color:#ccc;">取消置顶</span>
            #else
            <span class="layui-btn layui-btn-xs jie-admin" data-type="setTop" field="stick" rank="1">置顶</span>
            #end


            #if(article.is_quintessence ?? == 'on')
            <span class="layui-btn layui-btn-xs jie-admin" data-type="cancelQuintessence" type="set" field="status" rank="0" style="background-color:#ccc;">取消加精</span>
            #else
            <span class="layui-btn layui-btn-xs jie-admin" data-type="setQuintessence" field="status" rank="1">加精</span>
            #end


        #end
        </div>

        <span class="fly-list-nums">
            <a href="#comment"><i class="iconfont" title="回答">&#xe60c;</i> 66</a>
            <i class="iconfont" title="人气">&#xe60b;</i> #(article.pv)
          </span>
    </div>
    <div class="detail-about">
        <a class="fly-avatar" href="#">
            <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="#(article.user.nike_name == null ? article.user.name : article.user.nike_name)">
        </a>
        <div class="fly-detail-user">
            <a href="../user/home.html" class="fly-link">
                <cite>#(article.user.nike_name == null ? article.user.name : article.user.nike_name)</cite>
                <!--<i class="iconfont icon-renzheng" title="认证信息：{{ rows.user.approve }}"></i>-->
                <!--<i class="layui-badge fly-badge-vip">VIP3</i>-->
            </a>
            <span>#date(article.create_time)</span>
        </div>

        <div class="detail-hits" id="LAY_jieAdmin" data-id="123">
            <span style="padding-right: 10px; color: #FF7200"> <!--悬赏：60飞吻--></span>
            #shiroAuthenticated()
                #if(session.uid ?? == article.uid)
                <span class="layui-btn layui-btn-xs jie-admin " type="edit"><a href="/article/editView/#(article.url)">编辑此贴</a></span>
                #end
            #end
        </div>

    </div>
    <div class="detail-body photos">

        <link rel="stylesheet" href="/static/libs/editormd/css/editormd.preview.css"/>

        <div id="test-editormd-view" style="width: 100%">
            <textarea style="display:none;" name="test-editormd-markdown-doc">#(article.content)</textarea>
        </div>
    </div>
</div>


<!--region 回帖-->
<!--<div class="fly-paarticletail-box" id="flyReply">-->
<!--<fieldset class="layui-elem-field layui-field-title" style="text-align: center;">-->
<!--<legend>回帖</legend>-->
<!--</fieldset>-->

<!--<ul class="jieda" id="jieda">-->
<!--<li data-id="111" class="jieda-daan">-->
<!--<a name="item-1111111111"></a>-->
<!--<div claarticletail-abarticletail-about-reply">-->
<!--<a class="fly-avatar" href="">-->
<!--<img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"-->
<!--alt=" ">-->
<!--</a>-->
<!--<div class="articletail-user">-->
<!--<a href="" class="fly-link">-->
<!--<cite>贤心</cite>-->
<!--<i class="iconfont icon-renzheng" title="认证信息：XXX"></i>-->
<!--<i class="layui-badge fly-badge-vip">VIP3</i>-->
<!--</a>-->

<!--<span>(楼主)</span>-->
<!--&lt;!&ndash;-->
<!--<span style="color:#5FB878">(管理员)</span>-->
<!--<span style="color:#FF9E3F">（社区之光）</span>-->
<!--<span style="color:#999">（该号已被封）</span>-->
<!--&ndash;&gt;-->
<!--</div>-->

<!--<div claarticletail-hits">-->
<!--<span>2017-11-30</span>-->
<!--</div>-->

<!--<i class="iconfont icon-caina" title="最佳答案"></i>-->
<!--</div>-->
<!--<div claarticletail-body jieda-body photos">-->
<!--<p>香菇那个蓝瘦，这是一条被采纳的回帖</p>-->
<!--</div>-->
<!--<div class="jieda-reply">-->
<!--<span class="jieda-zan zanok" type="zan">-->
<!--<i class="iconfont icon-zan"></i>-->
<!--<em>66</em>-->
<!--</span>-->
<!--<span type="reply">-->
<!--<i class="iconfont icon-svgmoban53"></i>-->
<!--回复-->
<!--</span>-->
<!--<div class="jieda-admin">-->
<!--<span type="edit">编辑</span>-->
<!--<span type="del">删除</span>-->
<!--&lt;!&ndash; <span class="jieda-accept" type="accept">采纳</span> &ndash;&gt;-->
<!--</div>-->
<!--</div>-->
<!--</li>-->

<!--<li data-id="111">-->
<!--<a name="item-1111111111"></a>-->
<!--<div claarticletail-abarticletail-about-reply">-->
<!--<a class="fly-avatar" href="">-->
<!--<img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"-->
<!--alt=" ">-->
<!--</a>-->
<!--<div class="articletail-user">-->
<!--<a href="" class="fly-link">-->
<!--<cite>贤心</cite>-->
<!--</a>-->
<!--</div>-->
<!--<div claarticletail-hits">-->
<!--<span>2017-11-30</span>-->
<!--</div>-->
<!--</div>-->
<!--<div claarticletail-body jieda-body photos">-->
<!--<p>蓝瘦那个香菇，这是一条没被采纳的回帖</p>-->
<!--</div>-->
<!--<div class="jieda-reply">-->
<!--<span class="jieda-zan" type="zan">-->
<!--<i class="iconfont icon-zan"></i>-->
<!--<em>0</em>-->
<!--</span>-->
<!--<span type="reply">-->
<!--<i class="iconfont icon-svgmoban53"></i>-->
<!--回复-->
<!--</span>-->
<!--<div class="jieda-admin">-->
<!--<span type="edit">编辑</span>-->
<!--<span type="del">删除</span>-->
<!--<span class="jieda-accept" type="accept">采纳</span>-->
<!--</div>-->
<!--</div>-->
<!--</li>-->

<!--&lt;!&ndash; 无数据时 &ndash;&gt;-->
<!--&lt;!&ndash; <li class="fly-none">消灭零回复</li> &ndash;&gt;-->
<!--</ul>-->

<!--<div class="layui-form layui-form-pane">-->
<!--<form action="/jie/reply/" method="post">-->
<!--<div class="layui-form-item layui-form-text">-->
<!--<a name="comment"></a>-->
<!--<div class="layui-input-block">-->
<!--<textarea id="L_content" name="content" required lay-verify="required" placeholder="请输入内容"-->
<!--class="layui-textarea fly-editor" style="height: 150px;"></textarea>-->
<!--</div>-->
<!--</div>-->
<!--<div class="layui-form-item">-->
<!--<input type="hidden" name="jid" value="123">-->
<!--<button class="layui-btn" lay-filter="*" lay-submit>提交回复</button>-->
<!--</div>-->
<!--</form>-->
<!--</div>-->
<!--</div>-->
<!--endregion-->



<script src="/static/libs/editormd/lib/marked.min.js"></script>
<script src="/static/libs/editormd/lib/prettify.min.js"></script>

<script src="/static/libs/editormd/lib/raphael.min.js"></script>
<script src="/static/libs/editormd/lib/underscore.min.js"></script>
<script src="/static/libs/editormd/lib/sequence-diagram.min.js"></script>
<script src="/static/libs/editormd/lib/flowchart.min.js"></script>
<script src="/static/libs/editormd/lib/jquery.flowchart.min.js"></script>

<script src="/static/libs/editormd/editormd.js"></script>


<script>
     $(function () {
        var testEditormdView, testEditormdView2;

        testEditormdView = editormd.markdownToHTML("test-editormd-view", {
//            markdown: markdown,//+ "\r\n" + $("#append-test").text(),
            //htmlDecode      : true,       // 开启 HTML 标签解析，为了安全性，默认不开启
//            htmlDecode: "style,script,iframe",  // you can filter tags decode
            //toc             : false,
//            tocm: true,    // Using [TOCM]
            //tocContainer    : "#custom-toc-container", // 自定义 ToC 容器层
            //gfm             : false,
            //tocDropdown     : true,
            // markdownSourceCode : true, // 是否保留 Markdown 源码，即是否删除保存源码的 Textarea 标签
//            emoji: true,
            taskList: true,
            tex: true,  // 默认不解析
            flowChart: true,  // 默认不解析
            sequenceDiagram: true,  // 默认不解析
        });
    });
</script>


<script>

    layui.use(['element', 'layer','laypage'], function () {
        var element = layui.element;
        var layer = layui.layer;
        var aid = "#(article.id)";


        //region 点击事件监听
        var $ = layui.$, active = {
            //获取选中数据 批量删除
            delete: function () {
                layer.confirm('真的要删除么?', function (index) {
                    //向服务端发送删除指令
                    layui.$.ajax({
                        type: "post",
                        url: '/article/delete',
                        data: {id:aid},
                        success: function (data) {
                            if (200 === data.code) {
                                layer.msg('删除成功');
                                layer.close();
                                location.href='/article';

                            } else {
                                layer.alert('错误: ' + "<br/>" + data.msg);
                            }
                        },
                        error: function (data, textStatus, errorThrown) {
                            layer.msg('删除失败');
                        }
                    });
                });


            },
            setTop: function () { //设置置顶
                layer.confirm('真的要置顶么?', function (index) {
                    layui.$.ajax({
                        type: "post",
                        url: '/article/setTop',
                        data: {id:aid},
                        success: function (data) {
                            if (200 === data.code) {
                                layer.msg('置顶成功');
                                layer.close();
                                location.href='/article';

                            } else {
                                layer.alert('错误: ' + "<br/>" + data.msg);
                            }
                        },
                        error: function (data, textStatus, errorThrown) {
                            layer.msg('置顶失败');
                        }
                    });
                });
            },

            cancelTop: function () { //取消置顶
                layer.confirm('真的要取消置顶么?', function (index) {
                    layui.$.ajax({
                        type: "post",
                        url: '/article/cancelTop',
                        data: {id:aid},
                        success: function (data) {
                            if (200 === data.code) {
                                layer.msg('取消置顶成功');
                                layer.close();
                                location.href='/article';

                            } else {
                                layer.alert('错误: ' + "<br/>" + data.msg);
                            }
                        },
                        error: function (data, textStatus, errorThrown) {
                            layer.msg('取消置顶失败');
                        }
                    });
                });
            },
            setQuintessence: function () {//加精
                layer.confirm('真的要加精么?', function (index) {
                    layui.$.ajax({
                        type: "post",
                        url: '/article/setQuintessence',
                        data: {id:aid},
                        success: function (data) {
                            if (200 === data.code) {
                                layer.msg('加精成功');
                                layer.close();
                                location.href='/article';

                            } else {
                                layer.alert('错误: ' + "<br/>" + data.msg);
                            }
                        },
                        error: function (data, textStatus, errorThrown) {
                            layer.msg('加精失败');
                        }
                    });
                });
            },//取消加精
            cancelQuintessence: function () {
                layer.confirm('真的要取消加精么?', function (index) {
                    layui.$.ajax({
                        type: "post",
                        url: '/article/cancelQuintessence',
                        data: {id:aid},
                        success: function (data) {
                            if (200 === data.code) {
                                layer.msg('取消加精成功');
                                layer.close();
                                location.href='/article';

                            } else {
                                layer.alert('错误: ' + "<br/>" + data.msg);
                            }
                        },
                        error: function (data, textStatus, errorThrown) {
                            layer.msg('取消加精失败');
                        }
                    });
                });
            },
        };

        $('.detail-box .layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        //endregion

    });

</script>